def read_md():
    with open("work.md", "r", encoding="utf-8") as f:
        content = f.readlines()
        return content


def get_contents(contents):
    user = ""
    dst = ""
    task = ""
    res = ""

    indices = [i for i, s in enumerate(contents) if s.startswith("#")]
    split_arr = [contents[i:j] for i, j in zip([0] + indices, indices + [None])]

    for arr in split_arr:
        if len(arr) == 0:
            continue

        if "立马上传" in arr[0]:
            upload_flag = "".join(arr[1:]).strip()

        if "记录者" in arr[0]:
            user = "".join(arr[1:]).strip()

        if "目标" in arr[0]:
            dst = "　".join(arr[1:])

        if "任务" in arr[0]:
            task = "　".join(arr[1:])

        if "结果" in arr[0]:
            res = "　".join(arr[1:])

    return (upload_flag, user, dst, task, res)
